//
//  UserCell.m
//  SheShiDu
//
//  Created by 泉  姜 on 16/6/17.
//  Copyright © 2016年 单剑秋. All rights reserved.
//

#import "UserCell.h"

#define HEIGHT self.contentView.frame.size.height
#define WIDTH self.contentView.frame.size.width
@implementation UserCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backgroundImgView = [[UIImageView alloc] init];
        _backgroundImgView.backgroundColor = [UIColor cyanColor];
        _backgroundImgView.userInteractionEnabled = YES;
        [self.contentView addSubview:_backgroundImgView];
        
        UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
        self.effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
        [_backgroundImgView addSubview:_effectView];
        
        self.messageButton = [UIButton buttonWithType:UIButtonTypeCustom];
//        _messageButton.backgroundColor = [UIColor redColor];
        [_backgroundImgView addSubview:_messageButton];
        
        self.setUpButton = [UIButton buttonWithType:UIButtonTypeCustom];
//        _setUpButton.backgroundColor = [UIColor redColor];
        [_backgroundImgView addSubview:_setUpButton];
        
        self.telephoneLabel = [[UILabel alloc] init];
//        _telephoneLabel.backgroundColor = [UIColor yellowColor];
        _telephoneLabel.font = [UIFont systemFontOfSize:24];
        _telephoneLabel.textColor = [UIColor whiteColor];
        [_backgroundImgView addSubview:_telephoneLabel];
        
        self.positionImgView = [[UIImageView alloc] init];
//        _positionImgView.backgroundColor = [UIColor redColor];
        [_backgroundImgView addSubview:_positionImgView];
        
        self.positionLabel = [[UILabel alloc] init];
//        _positionLabel.backgroundColor = [UIColor redColor];
        _positionLabel.textColor = [UIColor whiteColor];
        _positionLabel.font = [UIFont systemFontOfSize:13];
        [_backgroundImgView addSubview:_positionLabel];
        
        self.lineLabel = [[UILabel alloc] init];
        _lineLabel.backgroundColor = [UIColor whiteColor];
        [_backgroundImgView addSubview:_lineLabel];
        
        self.lineLabel2 = [[UILabel alloc] init];
        _lineLabel2.backgroundColor = [UIColor whiteColor];
        [_backgroundImgView addSubview:_lineLabel2];
        
        self.lineLabel3 = [[UILabel alloc] init];
        _lineLabel3.backgroundColor = [UIColor whiteColor];
        [_backgroundImgView addSubview:_lineLabel3];
        
        self.orderButton = [QButton buttonWithType:UIButtonTypeCustom];
        [_backgroundImgView addSubview:_orderButton];
        
        self.livingButton = [LButton buttonWithType:UIButtonTypeCustom];
        [_backgroundImgView addSubview:_livingButton];
        
        self.renovateButton = [BButton buttonWithType:UIButtonTypeCustom];
        [_backgroundImgView addSubview:_renovateButton];
    }
    return self;
}

- (void)layoutSubviews
{
    _backgroundImgView.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
    _effectView.frame = CGRectMake(0, 0, _backgroundImgView.frame.size.width, _backgroundImgView.frame.size.height);
    _messageButton.frame = CGRectMake(WIDTH * (160 / 750.0), HEIGHT * (166 / 606.0), WIDTH * (54 / 750.0), HEIGHT * (44 / 606.0));
    _setUpButton.frame = CGRectMake(WIDTH * (530 / 750.0), HEIGHT * (160 /606.0), HEIGHT * (59 / 606.0), HEIGHT * (59 / 606.0));
    _telephoneLabel.frame = CGRectMake(WIDTH * (220 / 750.0), HEIGHT * (313 / 606.0), WIDTH * (315 / 750.0), HEIGHT * (35 / 606.0));
    _positionImgView.frame = CGRectMake(WIDTH * (272 / 750.0), HEIGHT * (367 / 606.0), WIDTH * (23 / 750.0), HEIGHT * (30 / 606.0));
    _positionLabel.frame = CGRectMake(WIDTH * (311 / 750.0), HEIGHT * (368 / 606.0), WIDTH * (184 / 750.0), HEIGHT * (37 / 606.0));
    _lineLabel.frame = CGRectMake(16, HEIGHT * (455 / 606.0), WIDTH - 32, 1);
    _lineLabel2.frame = CGRectMake((WIDTH - 32) / 3 + 16, HEIGHT * (455 / 606.0), 1, HEIGHT * (127 / 606.0));
    _lineLabel3.frame = CGRectMake((WIDTH - 32) / 3 * 2 + 16, HEIGHT * (455 / 606.0), 1, HEIGHT * (127 / 606.0));
    _orderButton.frame = CGRectMake(16, HEIGHT * (455 / 606.0), (WIDTH - 32) / 3, HEIGHT * (127 / 606.0));
    _livingButton.frame = CGRectMake((WIDTH - 32) / 3 + 16, HEIGHT * (455 / 606.0), (WIDTH - 32) / 3, HEIGHT * (127 / 606.0));
    _renovateButton.frame = CGRectMake((WIDTH - 32) / 3 * 2 + 16, HEIGHT * (455 / 606.0), (WIDTH - 32) / 3, HEIGHT * (127 / 606.0));
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
